package com.lg.service.impl;

import com.lg.entity.User;
import com.lg.mapper.UserMapper;
import com.lg.service.UserService;

import lombok.extern.slf4j.Slf4j;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sky
 * @since 2023-03-11
 */
@Transactional
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

	@Autowired
	UserMapper userMapper;
	
	// @Async
	@Override
	public List<User> listUser() throws Exception {
		log.info("listUser打印啊,线程名={}", Thread.currentThread().getName());
		return userMapper.listUser();
	}

	@Override
	public Integer insertUser(User user) throws Exception {
		userMapper.insert(user);
		if (true) {
			int i = 1/0;
		}
		userMapper.insertUser(user);
		return 1;
	}

	
	
	
}
